package dome3;

import javax.print.attribute.standard.NumberUp;

/**
 * Created with IntelliJ IDEA.
 * Description: 泛型方法代码测试
 * User: 王圆豪
 * Date: 2024-07-15
 * Time: 22:13
 */
public class Test {
    public static <E extends Number> int add(E a, E b){
        return a.intValue() + b.intValue();
    }
    public static <E> void mySwap(E[] array, int i, int j) {
        E t = array[i];
        array[i] = array[j];
        array[j] = t;
    }
    public static void main(String[] args) {
        Integer[] array = new Integer[]{1, 2};
        mySwap(array, 0, 1);
        for (int i = 0; i < array.length; i++) {
            System.out.println(array[i]);
        }
    }
}
